package com.qiaoanju.back.service.impl.system;

import com.qiaoanju.back.dao.system.IUserDao;
import com.qiaoanju.back.domain.system.UserModel;
import com.qiaoanju.back.dto.system.UserDto;
import com.qiaoanju.back.service.system.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by eversec on 2017/9/21.
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDao dao ;


    /**
     * @param user
     * @return
     */
    public int insert(UserModel user) {

        return dao.insert(user);
    }

    /**
     *
     * @param username
     * @param password
     * @return
     */
    public UserModel getUserByNamePwd(String username ,String password) {
        return dao.getUserByNamePwd(username, password);
    }

    /**
     * @param username
     * @return
     */
    public UserModel getUserByUsername(String username) {
        return dao.getUserByUsername(username);
    }

    /**
     * 获取登录用户
     *
     * @param username
     * @return
     */
    public UserDto getLoginUserByUsername(String username) {
        return dao.getLoginUserByNamePwd(username);
    }
}
